import { Component } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NzModalFooterComponent, NzModalService } from 'ng-zorro-antd/modal';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'my-app';
  functionmenu = false;
  showlog = false;
   
  handleCancel(): void {
    console.log('Button cancel clicked!');
    this.functionmenu = false;
    this.showlog = false;
    this.cleanall = false;
    this.clean = false;
    this.Warehousing = false;
    this.Increaseinventory = false;
    this.cleanallok =false;
    this.validateForm.reset();
  }
  constructor(private message: NzMessageService,
    private fb: FormBuilder,
    ) {}

  ngOnInit(): void {
    const data = [];
    for (let i = 0; i < 100; i++) {
      data.push({
        name: `Edward King ${i}`,
        age: 32,
        address: `入库 ${i}`
      });
    }
    this.listOfData = data;

    this.validateForm = this.fb.group({
      name: [null, [Validators.required]],
      number: [50, [Validators.required]],
    });

  }
  

    //功能选择菜单
    dialog() :void//声明标识符
    {
      this.functionmenu = true;
    }
    //日志查看
    loginfo() :void{
      this.showlog = true;
    }
    //日志模拟数据
    listOfData: ItemData[] = [];

   
    
    
      // 重新请求按钮处理
    Rerequested(): void {
      const id = this.message.loading('重新请求中，请稍后..', { nzDuration: 0 }).messageId;
      setTimeout(() => {
        this.message.remove(id);
        this.message.success("成功");
      }, 2500);
    }

    //全部清仓
    cleanall = false;
    cleanAll(): void {
      this.cleanall = true;
    }
    //清仓成功
    cleanallok= false;
    cleanAllok(): void {
      this.cleanall = false;
      this.cleanallok = true;
      setTimeout(() => (this.cleanallok = false), 1500);
    }
    //入库
    Warehousing = false;
    validateForm!: FormGroup;
    addware(): void{
      this.functionmenu = false;
      this.Warehousing = true;
    }
    //补料
    Increaseinventory = false;
    addinventory(): void{
      this.functionmenu = false;
      this.Increaseinventory = true;
    }
    //单独清仓
    clean = false;
    cleanThis(): void {
      this.functionmenu = false;
      this.clean = true;
    }
}
interface ItemData {
  name: string;
  age: number;
  address: string;
}
